import React, { Component } from 'react';
import { View,Platform,SafeAreaView,Dimensions} from 'react-native';
import constants from '../../../utils/constants';
import { createMaterialTopTabNavigator, createAppContainer } from 'react-navigation';
import { MaterialTopTabBar } from 'react-navigation-tabs';
import Record from './record';
import Report from './report';
import { Toast } from 'antd-mobile-rn';

const window = Dimensions.get("window");


const TabNavigator = createMaterialTopTabNavigator(
    {
        Record:Record,
        Report:Report,
    },
    {
      
        lazy: true,
        tabBarComponent: (props) => {
            return (
                <View
                    style={{
                      
                        backgroundColor: '#fff',
                        alignItems:"center",
                        paddingTop:Platform.OS === "ios"?(0):0
                
                      
                    }}
                >
                    <MaterialTopTabBar {...props} jumpToIndex={() => { }} />
                </View>
            )
        },
        tabBarOptions: {
            activeTintColor: constants.themeColor,
            inactiveTintColor: constants.themeColor,
            labelStyle: {
                fontSize: 18,


            },
            tabStyle:{
                width:120
            },
            style: {
                backgroundColor: "#fff",
                borderBottomWidth: 0,
                shadowOpacity: 0,
                elevation: 0,
                width: 250,
                alignContent: "center"
            },
            indicatorStyle: {
                backgroundColor: constants.themeColor,
                width: 45,
                marginLeft:38,
                marginBottom: 5,
               
            }
        },
        swipeEnabled: true
    }
);

const App = createAppContainer(TabNavigator);


export default class MainWrong extends Component {

    static navigationOptions = (e) => {
        return {
            title: "错题"
        }
    }

    constructor(props) {
        super(props);
        this.navigation = this.props.navigation;
       
      
    }

    render() {

        const {appNavigation} = this.props.screenProps;
        return (
            <SafeAreaView style={{flex:1}} ref="wrongMain" onLayout={(e)=>{
                appNavigation.setParams({
                    wrongMainHeight:e.nativeEvent.layout.height
                });
            }}>
                 <App screenProps={this.props.screenProps}/>
            </SafeAreaView>
           
        )
    }
}

    